package leet.ku._225;

import java.util.LinkedList;
import java.util.Queue;

class MyStack {
	
	Queue<Integer> data = new LinkedList<Integer>();
	
    // Push element x onto stack.
    public void push(int x) {
        int size = data.size();
        data.add(x);
        for (int i = 0; i < size; i++)
        	data.add(data.poll());
    }

    // Removes the element on top of the stack.
    public void pop() {
        data.poll();
    }

    // Get the top element.
    public int top() {
        return data.peek();
    }

    // Return whether the stack is empty.
    public boolean empty() {
        return data.isEmpty();
    }
}